/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author lomanda
 */
@Entity
@Table(name = "opiniaoFoto")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OpiniaoFoto.findAll", query = "SELECT o FROM OpiniaoFoto o"),
    @NamedQuery(name = "OpiniaoFoto.findByIdOpFoto", query = "SELECT o FROM OpiniaoFoto o WHERE o.idOpFoto = :idOpFoto"),
    @NamedQuery(name = "OpiniaoFoto.findByOpiniao", query = "SELECT o FROM OpiniaoFoto o WHERE o.opiniao = :opiniao"),
    @NamedQuery(name = "OpiniaoFoto.findByData", query = "SELECT o FROM OpiniaoFoto o WHERE o.data = :data")})
public class OpiniaoFoto implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "data")
    @Temporal(TemporalType.DATE)
    private Date data;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idOpFoto")
    private Integer idOpFoto;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "opiniao")
    private String opiniao;
    @JoinColumn(name = "fkUsuario", referencedColumnName = "idUsuario")
    @ManyToOne(optional = false)
    private Usuario fkUsuario;
    @JoinColumn(name = "fkFoto", referencedColumnName = "idFoto")
    @ManyToOne(optional = false)
    private Fotos fkFoto;

    public OpiniaoFoto() {
    }

    public OpiniaoFoto(Integer idOpFoto) {
        this.idOpFoto = idOpFoto;
    }

    public OpiniaoFoto(Integer idOpFoto, String opiniao, Date data) {
        this.idOpFoto = idOpFoto;
        this.opiniao = opiniao;
        this.data = data;
    }

    public Integer getIdOpFoto() {
        return idOpFoto;
    }

    public void setIdOpFoto(Integer idOpFoto) {
        this.idOpFoto = idOpFoto;
    }

    public String getOpiniao() {
        return opiniao;
    }

    public void setOpiniao(String opiniao) {
        this.opiniao = opiniao;
    }

    public Usuario getFkUsuario() {
        return fkUsuario;
    }

    public void setFkUsuario(Usuario fkUsuario) {
        this.fkUsuario = fkUsuario;
    }

    public Fotos getFkFoto() {
        return fkFoto;
    }

    public void setFkFoto(Fotos fkFoto) {
        this.fkFoto = fkFoto;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idOpFoto != null ? idOpFoto.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OpiniaoFoto)) {
            return false;
        }
        OpiniaoFoto other = (OpiniaoFoto) object;
        if ((this.idOpFoto == null && other.idOpFoto != null) || (this.idOpFoto != null && !this.idOpFoto.equals(other.idOpFoto))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.OpiniaoFoto[ idOpFoto=" + idOpFoto + " ]";
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }
    
}
